<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: DE
  Date: 2019/4/19
  Time: 15:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <title>登录</title>
    <link href="<%=basePath%>resources/layui/css/layui.css" rel="stylesheet"></link>
    <link href="<%=basePath%>resources/css/style.css" rel="stylesheet"></link>
</head>
<body>
<div class="layui-fluid layui-bg-cyan">
    <div class="layui-row layui-col-xs12 layui-col-md12" style="margin-top: 1%;border-radius: 5px">
        <div class="layui-col-xs12 layui-col-md4 layui-fluid"></div>
        <div class="layui-col-xs12 layui-col-md4 layui-bg-black layui-col-md-offset4" style="margin-top: 1%;border-radius: 5px">

            <div class="layui-col-md12"  style="margin-bottom: 5%">
                <span class="layui-col-md12" style="color: #ffffff;font-size: 40px;text-align: center">校园便捷服务平台</span><br>
                <span class="layui-col-md12" style="color: #ffffff;font-size: 20px;text-align: center">登录平台，享受便捷</span>

            </div>
            <form class="layui-form" action="<%=basePath%>login/gologin" method="post">
                <div class="layui-form-item 2layui-col-xs12 layui-col-md12">
                    <label class="layui-form-label">账号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="userAccount" lay-verify="number|content"  placeholder="请输入账号" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-col-xs12 layui-col-md12">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-inline">
                        <input type="password" name="userPassword" lay-verify="content" placeholder="请输入密码"  class="layui-input">
                    </div>
                </div>
                <c:if test="${msg!=null}">
                <div class="layui-form-item layui-col-xs12 layui-col-md12">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <span style="color: red">${msg} </span>
                    </div>
                </div>
                </c:if>
                <div class="layui-form-item layui-col-xs12 layui-col-md12">

                    <div class="layui-col-md12 layui-col-md-offset4">
                        <button class="layui-btn" lay-submit="" lay-filter="">立即登录</button>

                    </div>
                </div>
                <div class="layui-form-item layui-col-xs12 layui-col-md12">
                    <div class="layui-col-md12 layui-col-md-offset4">
                        <a href="<%=basePath%>page/register" style="color: white">没有账号？去注册</a>
                    </div>
                </div>

            </form>
        </div>
        <div class="layui-col-xs12 layui-col-md4 layui-bg-blue layui-fluid"></div>

    </div>
</div>
<script type="text/javascript" src="<%=basePath%>resources/jquery-3.2.1/jquery-3.2.1.js" ></script>
<script src="<%=basePath%>resources/layui/layui.all.js"></script>
<script src="<%=basePath%>resources/js/vip_comm.js"></script>
<script>
    layui.use(['form', 'layedit', 'layer'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,$ = layui.jquery;


        //自定义验证规则
        form.verify({
           pass: [
                /^[\S]{6,20}$/
                ,'密码必须6到20位，且不能出现空格'
            ]
            ,content: function(value){

                    if(value.length < 1){
                        return '内容不能为空';
                    }
            }
        });


        //监听提交
        /***
         * 用post提交
         */
      /*  form.on('submit(userSubmit)', function(data){
            /!* layer.alert(JSON.stringify(data.field), {                 title: '最终的提交信息'
             })*!/

            // console.log(JSON.stringify(data));
             console.log(JSON.stringify(data.field));

            $.ajax({
                url: "/user/login",
                type: "POST",
                data:data.field,
                success: function(data){

                    console.log(JSON.stringify(data));
                   /!* if(data.code==0){

                        layer.msg('登录成功');
                        return true;

                    }else{
                        layer.msg(data.msg);
                        return false;
                    }*!/
                   return false;
                }

            });


        });*/





    });




</script>
</body>
</html>
